package com.myspring.resttest.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.myspring.resttest.dao.SpringHibernateUserDao;
import com.myspring.resttest.model.SpringHibernateUser;
import com.myspring.resttest.service.SpringHibernateUserManager;

@Service
public class SpringHibernateUserManagerImpl implements
		SpringHibernateUserManager {

	@Autowired
	SpringHibernateUserDao userDao;

	@Override
	@Transactional
	public void insertUser(SpringHibernateUser user) {
		userDao.insertUser(user);
	}

	@Override
	@Transactional
	public SpringHibernateUser getUserById(int userId) {
		return userDao.getUserById(userId);
	}

	@Override
	@Transactional
	public SpringHibernateUser getUser(String username) {
		return userDao.getUser(username);
	}

	@Override
	@Transactional
	public List<SpringHibernateUser> getUsers() {
		return userDao.getUsers();
	}

}
